/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cl.bussines.entities;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Vogel
 */
@Entity
@Table(name = "tipo_moto")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TipoMoto.findAll", query = "SELECT t FROM TipoMoto t"),
    @NamedQuery(name = "TipoMoto.findByIdTipoMoto", query = "SELECT t FROM TipoMoto t WHERE t.idTipoMoto = :idTipoMoto"),
    @NamedQuery(name = "TipoMoto.findByTipoMoto", query = "SELECT t FROM TipoMoto t WHERE t.tipoMoto = :tipoMoto")})
public class TipoMoto implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_Tipo_Moto")
    private Integer idTipoMoto;
    @Size(max = 45)
    @Column(name = "Tipo_Moto")
    private String tipoMoto;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idTipoMoto")
    private Collection<Moto> motoCollection;

    public TipoMoto() {
    }

    public TipoMoto(Integer idTipoMoto) {
        this.idTipoMoto = idTipoMoto;
    }

    public Integer getIdTipoMoto() {
        return idTipoMoto;
    }

    public void setIdTipoMoto(Integer idTipoMoto) {
        this.idTipoMoto = idTipoMoto;
    }

    public String getTipoMoto() {
        return tipoMoto;
    }

    public void setTipoMoto(String tipoMoto) {
        this.tipoMoto = tipoMoto;
    }

    @XmlTransient
    public Collection<Moto> getMotoCollection() {
        return motoCollection;
    }

    public void setMotoCollection(Collection<Moto> motoCollection) {
        this.motoCollection = motoCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idTipoMoto != null ? idTipoMoto.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TipoMoto)) {
            return false;
        }
        TipoMoto other = (TipoMoto) object;
        if ((this.idTipoMoto == null && other.idTipoMoto != null) || (this.idTipoMoto != null && !this.idTipoMoto.equals(other.idTipoMoto))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "cl.bussines.entities.TipoMoto[ idTipoMoto=" + idTipoMoto + " ]";
    }
    
}
